#include <stdio.h>
#include <stdlib.h>

typedef struct  
{
    int index;
    int value;
} Data;

void sortIndex(Data *input, int left, int right)
{
    int l, r, random;
    Data n, temp;
    if (left >= right)
    {
        return;
    }

    random = (rand() % (right - left + 1)) + left;
    temp = input[left];
    input[left] = input[random];
    input[random] = temp;

    l = left;
    r = right;
    n = input[left];

    while (l < r)
    {
        while (l < r && input[r].index >= n.index)
        {
            r--;
        }
        input[l] = input[r];
        
        while (l < r && input[l].index <= n.index)
        {
            l++;
        }
        input[r] = input[l];
    }
    input[l] = n;
    while (input[l].index == n.index)
    {
        l--;
    }
    while (input[r].index == n.index)
    {
        r++;
    }

    sortIndex(input, left, l);    
    sortIndex(input, r, right);
}

void sort(Data *input, int left, int right)
{
    int l, r, random;
    Data n, temp;
    if (left >= right)
    {
        return;
    }

    random = (rand() % (right - left + 1)) + left;
    temp = input[left];
    input[left] = input[random];
    input[random] = temp;

    l = left;
    r = right;
    n = input[left];

    while (l < r)
    {
        while (l < r && input[r].value <= n.value)
        {
            r--;
        }
        input[l] = input[r];
        
        while (l < r && input[l].value >= n.value)
        {
            l++;
        }
        input[r] = input[l];
    }
    input[l] = n;
    while (input[l].value == n.value)
    {
        l--;
    }
    while (input[r].value == n.value)
    {
        r++;
    }

    sort(input, left, l);    
    sort(input, r, right);
}

int main(int argc, char const *argv[])
{
    int n, m, i, v, o, j;
    Data input[8192];
    scanf("%d%d", &n, &m);
    for (i = 0; i < n; i++)
    {
        scanf("%d%d", &input[i].index, &input[i].value);
    }
    sort(input, 0, n - 1);
    
    for (i = 0; i < n;)
    {
        j = i + 1;
        while (input[j].value == input[j - 1].value)
        {
            j++;
        }

        sortIndex(input, i, j - 1);
        i = j;
    }

    m = (int)(m * 1.5f);
    v = input[m - 1].value;
    
    for (i = 0; i < n; i++)
    {
        if (input[i].value < v)
        {
            break;
        }
    }

    o = i;
    
    printf("%d %d", v, o);

    for (i = 0; i < o; i++)
    {
        printf("\n%d %d", input[i].index, input[i].value);
    }

    return 0;
}
